import json

def first():
    f = open('Lab3/username.json', 'w',encoding = 'utf-8')
    choice = input("姓名:")
    f.write(json.dumps(choice))
    f.close()
    f = open('Lab3/username.json', 'r',encoding = 'utf-8')
    fl = f.read()
    print("欢迎"+json.dumps(json.loads(fl),ensure_ascii=False)+"首次到来!")
    f.close()

def again():
    f = open('Lab3/username.json', 'r',encoding = 'utf-8')
    fl = f.read()
    print("欢迎，老成员"+json.dumps(json.loads(fl),ensure_ascii=False)+"的到来！")
    f.close()

try:
    again()
except FileNotFoundError:
    first()
